home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / c-tools / c_examples / tab / tab_example.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-19  |  1.9 KB  |  83 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. // Tab Example
  3. // 5.18.96 Deryk Robosson
  4.  
  5. //////////////////////////////////////////////////////////////////////////////
  6. // Includes
  7. #include "aframe:include/amigaapp.hpp"
  8. #include "aframe:include/window.hpp"
  9. #include "aframe:include/rect.hpp"
  10. #include "aframe:include/tab.hpp"
  11. #include "aframe:include/reqtools.hpp"
  12.  
  13. TabLabel tablabels[] = {
  14.     { "First", -1, -1, -1, -1 },
  15.     { "Second",  -1, -1, -1, -1 },
  16.     { "Third",   -1, -1, -1, -1 },
  17.     { "Fourth",   -1, -1, -1, -1 },
  18.     NULL
  19. };
  20.  
  21. //////////////////////////////////////////////////////////////////////////////
  22. // ControlWindow Class Definition
  23.  
  24. class ControlWindow : public AFWindow
  25.  
  26. {
  27. public:
  28.     virtual void OnGadgetUp(LPIntuiMessage imess);
  29.  
  30.     AFTab tab;
  31.     AFReqTools rt;
  32. };
  33.  
  34. //////////////////////////////////////////////////////////////////////////////
  35. // ControlWindow Implementation routines
  36.  
  37. void ControlWindow::OnGadgetUp(LPIntuiMessage imess)
  38. {
  39.   switch(((struct Gadget*)imess->IAddress)->GadgetID) {
  40.  
  41.   case 100:     // Test tab gadget
  42.     switch(tab.GetCurrentTab()) {
  43.         case 0:
  44.             rt.EZRequest("First","Ok");
  45.             break;
  46.         case 1:
  47.             rt.EZRequest("Second","Ok");
  48.             break;
  49.         case 2:
  50.              rt.EZRequest("Third","Ok");
  51.             break;
  52.         case 3:
  53.             rt.EZRequest("Fourth","Ok");
  54.             break;
  55.         default:
  56.             break;
  57.     }
  58.     break;
  59.   default:
  60.     AFWindow::OnGadgetUp(imess);
  61.     break;
  62.   }
  63. }
  64.  
  65. //////////////////////////////////////////////////////////////////////////////
  66. // MAIN
  67.  
  68. void main()
  69. {
  70.     AFAmigaApp theApp;
  71.     ControlWindow win;
  72.     AFRect rect(10,10,410,310);
  73.  
  74.     win.Create(&theApp,&rect,"AFrame Tab Example");
  75.  
  76.     rect.SetRect(2,164,250,194);
  77.     win.tab.Create(&win, &rect, tablabels, 100);
  78.  
  79.     win.RefreshGadgets();
  80.  
  81.     theApp.RunApp();
  82. }
  83.